import { PropType } from "vue"
// 如果 ButtonType 不传值，默认为 'primary'
export type ButtonType = 'primary' | 'info' | 'success' | 'warning'
export type ButtonSize = 'normal' | 'small' | 'large'
export type NativeType = 'button' | 'submit' | 'reset'

// 定义 props 的方式：
// 写法1
export interface ButtonProps {
    type?: ButtonType;
    size?: ButtonSize;
    plain?: boolean;
    round?: boolean;
    circle?: boolean;
    disabled?: boolean;
    NativeType?: NativeType;
    autofocus?: boolean;
    icon?: string;
    loading?: boolean
}

export interface ButtonInstance {
    ref: HTMLButtonElement  // ref 的类型为 HTMLButtonElement
}

// 写法2
export const buttonProps = {
    type: {
        type: String as PropType<ButtonType>
    },
    size: {
        type: String as PropType<ButtonSize>
    },
    plain: {
        type: Boolean
    },
    round: {
        type: Boolean
    },
    circle: {
        type: Boolean
    },
    disabled: {
        type: Boolean
    }
}
